package com.java.module.chat.util;

/**
 * 消息状态
 * 
 * @author yilabao
 * @date 2019年6月11日
 */
public enum MsgStatusEnum {

    /**
     * 未知
     */
    UNKNOWN(404, "未知"),
    /**
     * 未读
     */
    UNREAD(0, "未读"),
    /**
     * 已读
     */
    READ(1, "已读"),
    /**
     * 已撤回
     */
    WITHDRAWN(2, "已撤回");

    private Integer msgStatus;
    private String msgStatusTitle;

    private MsgStatusEnum(Integer msgStatus, String msgStatusTitle) {
        this.msgStatus = msgStatus;
        this.msgStatusTitle = msgStatusTitle;
    }

    public Integer getMsgStatus() {
        return msgStatus;
    }

    public String getMsgStatusTitle() {
        return msgStatusTitle;
    }

    public static MsgStatusEnum getMsgStatusEnum(Integer msgStatus) {
        int two = 2;
        MsgStatusEnum[] values = MsgStatusEnum.values();
        if (msgStatus >= 0 && msgStatus <= values.length - two) {
            return values[msgStatus + 1];
        }
        return UNKNOWN;
    }

}